package com.ruoyi.supermarket.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.supermarket.domain.SupermarketShelf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.supermarket.mapper.SupermarketComShelfMapper;
import com.ruoyi.supermarket.domain.SupermarketComShelf;
import com.ruoyi.supermarket.service.ISupermarketComShelfService;

/**
 * 超市货架信息Service业务层处理
 * 
 * @author faye
 * @date 2024-05-28
 */
@Service
public class SupermarketComShelfServiceImpl implements ISupermarketComShelfService 
{
    @Autowired
    private SupermarketComShelfMapper supermarketComShelfMapper;

    /**
     * 查询超市货架信息
     * 
     * @param storageId 超市货架信息主键
     * @return 超市货架信息
     */
    @Override
    public SupermarketComShelf selectSupermarketComShelfByStorageId(Long storageId)
    {
        return supermarketComShelfMapper.selectSupermarketComShelfByStorageId(storageId);
    }


    @Override
    public List<SupermarketShelf> selectShelfByComId(Long commodityId){

        return supermarketComShelfMapper.selectShelfByComId(commodityId);
    }

    /**
     * 查询超市货架信息列表
     * 
     * @param supermarketComShelf 超市货架信息
     * @return 超市货架信息
     */
    @Override
    public List<SupermarketComShelf> selectSupermarketComShelfList(SupermarketComShelf supermarketComShelf)
    {
        return supermarketComShelfMapper.selectSupermarketComShelfList(supermarketComShelf);
    }

    /**
     * 新增超市货架信息
     * 
     * @param supermarketComShelf 超市货架信息
     * @return 结果
     */
    @Override
    public int insertSupermarketComShelf(SupermarketComShelf supermarketComShelf)
    {
        supermarketComShelf.setCreateTime(DateUtils.getNowDate());
        return supermarketComShelfMapper.insertSupermarketComShelf(supermarketComShelf);
    }

    /**
     * 修改超市货架信息
     * 
     * @param supermarketComShelf 超市货架信息
     * @return 结果
     */
    @Override
    public int updateSupermarketComShelf(SupermarketComShelf supermarketComShelf)
    {
        supermarketComShelf.setUpdateTime(DateUtils.getNowDate());
        return supermarketComShelfMapper.updateSupermarketComShelf(supermarketComShelf);
    }

    /**
     * 批量删除超市货架信息
     * 
     * @param storageIds 需要删除的超市货架信息主键
     * @return 结果
     */
    @Override
    public int deleteSupermarketComShelfByStorageIds(Long[] storageIds)
    {
        return supermarketComShelfMapper.deleteSupermarketComShelfByStorageIds(storageIds);
    }

    /**
     * 删除超市货架信息信息
     * 
     * @param storageId 超市货架信息主键
     * @return 结果
     */
    @Override
    public int deleteSupermarketComShelfByStorageId(Long storageId)
    {
        return supermarketComShelfMapper.deleteSupermarketComShelfByStorageId(storageId);
    }
}
